#include "FluidBB.h"

int N;
float dt, diff, visc, loss;
float force, source;
int border_mode;
int dvel;

float * u, * v, * u_prev, * v_prev;
float * dens, * dens_prev;

////////////////////////////////////////
// Plugin infos
////////////////////////////////////////
CKERROR ExitInstance(CKContext* context);
CKPluginInfo g_PluginInfo;

PLUGIN_EXPORT int CKGetPluginInfoCount() 
{
	return 1;
}

CKERROR InitInstance(CKContext *context)
{
	CKParameterManager* pm = context->GetParameterManager();

	pm->RegisterNewEnum(CKPGUID_BORDERMODE, "Border mode","Collision=0,Overlap=1");

	return CK_OK;
}

CKERROR ExitInstance(CKContext* context)
{
	CKParameterManager* pm = context->GetParameterManager();

	pm->UnRegisterParameterType(CKPGUID_BORDERMODE);

	return CK_OK;
}

PLUGIN_EXPORT CKPluginInfo* CKGetPluginInfo(int Index) 
{
	switch (Index) 
	{
	case 0:
		g_PluginInfo.m_Author = "Jonathan DERROUGH";
		g_PluginInfo.m_Description = "Simulates a fluid in a texture";
		g_PluginInfo.m_Extension = "";
		g_PluginInfo.m_Type = CKPLUGIN_BEHAVIOR_DLL;
		g_PluginInfo.m_Version = 0x000001;
		g_PluginInfo.m_InitInstanceFct	= InitInstance; 
		g_PluginInfo.m_ExitInstanceFct = ExitInstance;
		g_PluginInfo.m_GUID = PLUGIN_GUID;
		g_PluginInfo.m_Summary = "FluidBB";

		break;
	}
	return (&g_PluginInfo);
}

void RegisterBehaviorDeclarations(XObjectDeclarationArray *reg) 
{
	RegisterBehavior ( reg, FillBehaviorUpdateFluid );
	RegisterBehavior ( reg, FillBehaviorAddVelocity );
	RegisterBehavior ( reg, FillBehaviorAddDensity );
	RegisterBehavior ( reg, FillBehaviorWriteTexture );
	RegisterBehavior ( reg, FillBehaviorClear );
}
